<?php
	class CustomerSearchForm extends Zend_Form{
		public function __construct($options = null){
			parent::__construct($options);
			$this->addPrefixPath('Vmg_Form_Decorator', 'Vmg/Form/Decorator', 'decorator');

			// load translator
			$registry = Zend_Registry::getInstance();
			$translate = $registry->get('Zend_Translate');
			$access_levels = $registry->get('access_level_config');
			$others_config = $registry->get('others_config');

			// set up number validator
			$number_validator = new Zend_Validate_Digits();
			$number_validator->setMessage("This field is only allowed numbers to be keyed in");
			$number_validator->setTranslator($translate);

			// set string length validator
			$phone_validator = new Zend_Validate_StringLength();
			$phone_validator->setMessage("The length of this field must be between %min% and %max%");
			$phone_validator->setMin($others_config->min_cellphone_length);
			$phone_validator->setMax($others_config->max_cellphone_length);

			// set up form
			$this->setName('customersearch');
			$this->setAttrib('id', 'customersearchForm');

			$mobile_number = new Zend_Form_Element_Text("mobileCustomerSearchForm");
			$mobile_number->setLabel($translate->_("Mobile number"))
			//->setRequired(true)
			->addFilter('StripTags')
			->addFilter('StringTrim')
			->setDecorators(array("Composite"))
			->setAttrib('size', 15)
			->addValidator($number_validator)

			;

			$submit = new Zend_Form_Element_Submit('submitCustomerSearchForm');
			$submit->setAttrib('id', 'submitCustomerSearchForm');
			$submit->setLabel('')
				->setValue($translate->_('Search'))
				->setDecorators(array("Composite"))
			;
			$this->addElements(array($mobile_number, $submit));
		}
	}

?>